package com.party.core.model.wechat;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by wei.li
 *
 * @date 2017/8/30 0030
 * @time 14:13
 */
public enum  WechatMessageReplyType {

    TEXT(0, "text"),

    IMAGE(1, "image"),

    VOICE(2, "voice"),

    VIDEO(3, "video"),

    MUSIC(4, "music"),

    NEWS(5, "news");

    //状态码
    private Integer code;

    //状态值
    private String value;

    WechatMessageReplyType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }


    public static String getValue(Integer code){
        for (WechatMessageReplyType wechatMessageReplyType : WechatMessageReplyType.values()){
            if (code.equals(wechatMessageReplyType.getCode())){
                return wechatMessageReplyType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap(){
        Map<Integer, String> map = Maps.newHashMap();
        for (WechatMessageReplyType wechatMessageReplyType : WechatMessageReplyType.values()){
            map.put(wechatMessageReplyType.getCode(), wechatMessageReplyType.getValue());
        }
        return map;
    }
}
